import java.util.Scanner;

public class TestMain {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] arr = new int[n];
        int left = 0;
        int count = 0;
        int tmp = 0;
        for(int i = 0; i < n; i++) {
            arr[i] = scanner.nextInt();
        }
        while(left < n || n - left < count) {
            tmp = 0;
            for(int i = left; i < n; i++) {
                if(arr[i] > arr[left]) {
                    tmp++;
                }
            }
            count = Math.max(tmp,count);
            left ++;
        }
        System.out.println(count);
    }
}
